#include <cstdio>
#include <sys/wait.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        int cnt = 5;
        while(cnt--)
        {
            printf("i am child pid:%d,ppid:%d\n",getpid(),getppid());
            sleep(1);
        }
        return 5;

    }
    int status = 0;
    int ret = wait(&status);
    printf("wait process success,status=%d,ret=%d\n",status,ret);
    return 0;
}
